/*
 * ScenarioFactory.java
 * 
 * Created on 21.05.2007, 18:47:46
 * 
 * 
 */

package logrus.beanmock.scenario;

import java.util.Arrays;
import java.util.List;


/**
 *
 * @author serge
 */
public class ScenarioFactoryImpl implements ScenarioFactory {
    
    private final ScenarioBuilder builder;
    
    private final List<ScenarioConfigurer> configurers;

    public ScenarioFactoryImpl(ScenarioBuilder builder, ScenarioConfigurer... configurers) {
        this.builder = builder;
        this.configurers = Arrays.asList(configurers);
    }

    public Scenario getScenario() {
        for (ScenarioConfigurer sc : configurers) {
            sc.configure(builder);
        }
        return builder.getScenario();
    }

}
